Skip to content

fix(ios): answer Safari's "Open in" prompt and inner-panel SpringBoard alerts - #4001

Merged
thymikee merged 8 commits into
mainfrom
fix/ios-springboard-modal-host-window
Oct 31, 2026
Merged

thymikee merged 8 commits into
mainfrom
fix/ios-springboard-modal-host-window

Conversation

@thymikee

@thymikee thymikee commented Oct 27, 2026 •

Copy link
Copy Markdown
Member

Summary

Two prompts answered ALERT_NOT_FOUND with "Open … in “App”?" on screen:

  • Safari's page prompt is an SFDialogView, not an alert, so it failed on every iPhone. The runner now finds it by that identifier and checks the answer against it.
  • SpringBoard's prompt (from openurl) was missed on the Duo's inner panel: springboard.frame names only the outer panel (466×678). Each SpringBoard alert is now placed, tapped and checked in its own window. An unreadable window refuses the tap.

Validation

  • pnpm check:affected --run --head 428c5ff490: passed.
  • Unit tests (iPhone 17 Pro sim): 35 alert/modal tests, plus new placement and Safari-dialog tests.
  • alert get → dismiss/accept → alert get (ALERT_NOT_FOUND), with screenshots. SpringBoard: rebased head. Safari: 3369c71c01 (same runner code):
Prompt Device Tap reference
SpringBoard Duo unfolded (alert center x=475.7) 951×669, displayID 3
SpringBoard Duo folded 466×678, displayID 1
SpringBoard iPhone 17 Pro 402×874
Safari Duo unfolded 951×669, displayID 3
Safari Duo folded 466×678
Safari iPhone 17 Pro (base: ALERT_NOT_FOUND) 402×874

Follow-up: SpringBoard coordinate taps, viewport and capture still use its first window (a 223×317 status-bar window on the Duo). Alert taps don't, because they route through the alert's own window. Fixing the rest needs a panel-aware SpringBoard window resolver (ADR 0025).

🤖 Generated with Claude Code

@github-actions

github-actions Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Size Report

Metric Base Current Diff
Installed (including dependencies) 5.62 MB 5.63 MB +2.2 kB
Package (unpacked) 5.62 MB 5.63 MB +2.2 kB
Package (download) 1.71 MB 1.71 MB +490 B

Startup median (7 runs, lower is better):

Scenario Base Current Diff
CLI --version 43.4 ms 41.5 ms -2.0 ms
CLI --help 88.6 ms 87.4 ms -1.2 ms

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 5 files

Reply with feedback, questions, or to request a fix.

View guided diff | Turn on auto-fix | Re-trigger cubic

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 6 files (changes from recent commits).

Reply with feedback, questions, or to request a fix.

View guided diff | Turn on auto-fix | Re-trigger cubic

@thymikee

Copy link
Copy Markdown
Member Author

I reviewed 07cb4a8. The code change looks right, but nothing shows yet that it answers an inner-panel alert and verifies the result truthfully.

The only live foldable run is at c84f8d5. That commit tapped through the hosting window but still verified with the old observation, which used the SpringBoard app frame (outer panel) as the viewport for every descendant (RunnerTests+AlertObservation.swift#L69). An inner-panel alert was always observed as absent, so alert dismiss reported success whether or not the tap hit the button. The per-window verification viewport (7bb7062) and the unreadable-window handling (07cb4a8) have had no foldable run, and the iPad run cannot exercise the multi-window case. Please run on the unfolded iPhone Duo simulator at 07cb4a8 with a SpringBoard alert on the inner panel (alert center x beyond the outer 466-pt window). It should show: alert get lists the alert and its buttons; the runner log line AGENT_DEVICE_RUNNER_ALERT_ACTIVATION with a point near x=476; the synthesized dispatch log with a referenceFrame equal to the inner window frame, not 466x678; alert dismiss (or accept) returns ok; a second alert get returns ALERT_NOT_FOUND; and a screenshot shows the alert gone. Please repeat it folded, and once on a single-screen iPhone simulator as a non-foldable regression check.

Not blocking, and fine to take or leave: the rule that a SpringBoard modal is visible relative to its own hosting window now lives in two places, isBlockingSystemModal and alertSnapshots (RunnerTests+SystemModal.swift#L161), and no test would fail on the base code, so you could extract the center-in-host-window decision into a pure function and test it with an outer-panel frame and an inner-panel center, or state in the PR that coverage is device-only; also, resolveAlert now probes SpringBoard before the session's active app and accepts a modal from any SpringBoard window (RunnerTests+BlockingSystemModalResolution.swift#L25), so on an unfolded foldable running another app on the other panel, alert accept could answer a prompt that app raised, which needs no change here and fits the panel-aware SpringBoard resolver planned as a follow-up (ADR 0025).

Of the open inline threads, the one on the dismissPopup window visibility check still applies (#4001 (comment)). It predates this PR and is off the SpringBoard route it fixes, so please either fix it here or reply on the thread with why it can wait. Two do not apply and can be resolved: the finite-frame check in SystemModal.swift keeps the base behavior, and Alert.swift validates the frame before any tap (#4001 (comment)); the width/height guard in SynthesizedGesturePolicy.swift is the base guard moved verbatim (#4001 (comment)).

CI is green: 16 checks, none failing, on 07cb4a8. CI cannot reach the foldable multi-window route, so green says nothing about the changed device path. I had no foldable simulator, so the 466x678 outer-window claim and the inner-panel placement are unverified on my side, and I did not check that the rotation mapping handles an absolute inner-panel point for a non-origin window in a rotated orientation. I also could not tell whether the wider viewport makes more than one SpringBoard candidate visible on a Duo, which would make verification report unconfirmed. Before merge, please attach the unfolded iPhone Duo run above, plus the folded and single-screen iPhone checks.

@thymikee thymikee changed the title fix(ios): find and answer a SpringBoard alert on a foldable's other panel fix(ios): answer Safari's "Open in" prompt and inner-panel SpringBoard alerts Oct 28, 2026
@vercel

vercel Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
agent-device-website Ready Ready Preview Oct 30, 2026 8:55pm UTC

Request Review

@thymikee

Copy link
Copy Markdown
Member Author

Addressed at 3369c71.

  • Root cause of the report: the "Open this page in …?" prompt is Safari's SFDialogView, not a SpringBoard alert. It reproduced as ALERT_NOT_FOUND on a single-screen iPhone 17 Pro too. The fix finds the dialog by that identifier.
  • Device runs at the head:
    • iPhone 17 Pro, Duo folded and Duo unfolded.
    • On each, alert get lists Cancel/Open, dismiss and accept return ok, a second alert get returns ALERT_NOT_FOUND, and a screenshot confirms the prompt is gone.
    • Unfolded Duo: ALERT_ACTIVATION point=(586.2,396.5), dispatched with reference=(0,0,951,669) on displayID 3, the inner panel.
  • SpringBoard-panel path at the head: still no Duo run. Duo SpringBoard taps go to the 223×317 status-bar window, so I can't raise a SpringBoard alert there. This is the resolver follow-up.
  • Pure placement rule: taken. isPlaced now serves both the probe and the observation, and a unit test covers an inner-panel alert against the outer and inner window frames. It fails closed on non-finite frames.
  • dismissPopup thread: fixed, since a window is now judged against its own frame.

@github-actions

github-actions Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor
PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://callstack.github.io/agent-device/pr-preview/pr-4001/

Built to branch gh-pages at 2026-10-28 11:42 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 6 files (changes from recent commits).

Reply with feedback, questions, or to request a fix.

View guided diff | Turn on auto-fix | Re-trigger cubic

Comment thread website/docs/docs/commands.md Resolved
Comment thread website/docs/docs/commands.md Resolved
@thymikee

Copy link
Copy Markdown
Member Author

The earlier review at 07cb4a8 asked for live evidence and had open geometry questions; the code at ac82af3 now addresses the geometry ones, but the inner-panel SpringBoard route is still not shown to work on a device.

Fixed since then: alertSnapshots matches a window against its own frame before it descends, isBlockingSystemModal goes through isPlaced, activateAlertButton refuses with .unsupported when the host window frame is invalid, and the gesture guard uses SnapshotGeometry.isPositiveFinite. The two docs/help threads are also addressed.

What remains: there is no live run on a foldable at a commit that has the per-window verification (7bb7062 and later). The PR body says it was not rerun at head because "Duo SpringBoard taps go to its 223x317 status-bar window". Does that routing also affect the alert path (alert.window from springboard.windows.containing(.alert), see https://github.com/callstack/agent-device/blob/ac82af3/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+AlertObservation.swift#L69)? If it does, a misrouted tap ends in ALERT_DEADLINE_EXCEEDED or a false success, and the title and body claim more than is shown. Please run alert get, alert dismiss (or accept), then alert get again on the unfolded iPhone Duo simulator at ac82af3, with a SpringBoard alert on the inner panel (alert center x beyond 466). Attach the AGENT_DEVICE_RUNNER_ALERT_ACTIVATION point, the synthesized dispatch referenceFrame equal to the inner window (951x669, not 223x317 or 466x678), dismiss ok, ALERT_NOT_FOUND afterwards, and a screenshot. Repeat folded and on a single-screen iPhone. If the routing does hit this path, could you scope the title and body to Safari and land the SpringBoard part with the ADR 0025 resolver? The Safari before/after runs are described in the PR body but have no logs or screenshots attached.

Not blocking, take or leave: no unit test reaches the new .safariDialog source (https://github.com/callstack/agent-device/blob/ac82af3/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Alert.swift#L60), so a snapshot-level test that alertSnapshots(source: .safariDialog) matches an SFDialogView node and ignores an .alert node, or a note that coverage is device-only, would help.

I did not run a simulator or the unit tests, so I could not confirm that Safari's prompt is an otherElement with identifier SFDialogView, that RunnerAlertButtonChoice picks Open/Cancel correctly, or whether an SFSafariViewController inside a third-party app exposes the dialog through that app's tree.

The open inline threads #4001 (comment), #4001 (comment), #4001 (comment) and #4001 (comment) (window-frame matching, modal placement, host-window guard, finite-frame guard) are fixed at ac82af3, as are #4001 (comment) (commands.md scope) and #4001 (comment) (Alerts help); please resolve them.

CI is not finished: Smoke Tests is still running, and Vercel (agent-device-website) fails. The diff touches one prose line in website/docs/docs/commands.md:435 that Vercel builds, and Vercel was green at 07cb4a8 before that line existed, so please check the Vercel log. Neither job reaches the foldable runner path. Before merge, attach the Duo run at ac82af3 (or narrow the PR to Safari), add the folded and single-screen checks, and get Smoke and Vercel green.

thymikee and others added 7 commits October 30, 2026 20:49
…anel

A foldable's SpringBoard has windows on each panel, but springboard.frame
names only the outer one. The blocking-modal probe dropped an alert whose
center lay outside that frame, so an "Open in" launch confirmation on the
unfolded iPhone Duo's inner panel read as absent, and alert get/accept
answered ALERT_NOT_FOUND for every session app other than SpringBoard. The
activation tap also routed through SpringBoard's first window, the dark
outer panel, so even a found alert was never answered.

The probe now finds each alert or sheet through the SpringBoard window that
hosts it, places it against that window, and routes the alert activation
through the same window's display.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The post-tap observation placed SpringBoard alerts against the application
frame, which on a foldable names one panel, so an alert on the other panel
read as gone right after any tap. Each window now bounds what it hosts.
The probe also stops between windows once its deadline is spent.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An alert resolved through its SpringBoard host window no longer falls back
to the owner app's first window when that window's frame cannot be read;
on a foldable that fallback is another panel. The activation reports the
refusal instead. The host window is an immutable field, the frame
validation is shared through SynthesizedCoordinateContext(validating:),
and the modal probe checks its deadline before each modal it reads.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The probe and the post-tap observation each decided whether a modal sits in
the window hosting it. One pure rule now owns that decision, rejects
non-finite frames, and judges a window against its own frame, so a dismiss
popup window on a foldable's other panel is no longer read as absent.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Safari draws its page prompts as an SFDialogView, not an alert, so `alert`
reported "alert not found" while the prompt was on screen, on every iPhone.
The runner now finds the dialog by that identifier and verifies its answer
against the same surface.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@thymikee
thymikee force-pushed the fix/ios-springboard-modal-host-window branch from ac82af3 to 8cf03e5 Compare October 30, 2026 20:41

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 2 files (changes from recent commits).

Reply with feedback, questions, or to request a fix.

View guided diff | Turn on auto-fix | Re-trigger cubic

…test

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@thymikee

Copy link
Copy Markdown
Member Author

Rebased on main. Head is 428c5ff, and check:affected passes.

Inner-panel SpringBoard route, run live. The alert path doesn't use the status-bar window that coordinate taps hit. The tap goes through the window that contains the alert. To raise SpringBoard's own "Open in “Agent Device Tester”?" alert, I ran xcrun simctl openurl with the Tester app open. Run on the rebased head:

  • Duo unfolded:
    • Alert rect (315.7,267.3,320×126.3), center x=475.7.
    • dismiss: ALERT_ACTIVATION label=Cancel point=(401.7,353.7), then SYNTHESIZED_DISPATCH reference=(0,0,951,669) orientation=4, displayID=3.
    • accept: label=Open point=(549.7,353.7), same reference.
    • Both return ok. The second alert get returns ALERT_NOT_FOUND, and the screenshot shows the alert gone.
  • Duo folded: Cancel at (147,358) and Open at (295,358), reference=(0,0,466,678), displayID=1. Both return ok, then ALERT_NOT_FOUND.
  • iPhone 17 Pro: Cancel at (127,474) and Open at (275,474), reference=(0,0,402,874). Both return ok, then ALERT_NOT_FOUND.

Safari prompt (3369c71c01, same runner code):

  • Duo unfolded: Cancel at (586.2,396.5) and Open at (654.2,396.5), reference 951×669, displayID 3.
  • Duo folded: reference 466×678.
  • iPhone 17 Pro: reference 402×874.
  • On base, the iPhone returns ALERT_NOT_FOUND.

I can't attach the screenshots from the CLI. I checked each one: the alert is present before the action and gone after. I'm happy to share them another way.

Unit test. Taken. testSafariDialogObservationMatchesOnlyTheDialogView checks that .safariDialog matches only the SFDialogView node, not an .alert or an unrelated .other node. .appAlert matches only the alert. Both new tests and the 35 alert/modal tests pass on an iPhone 17 Pro sim.

Title. I kept the SpringBoard part, since the runs above show the alert path works on both panels. ADR 0025 remains the follow-up for SpringBoard coordinate taps, viewport and capture.

Open. I haven't checked how SFSafariViewController behaves inside a third-party app. Its dialog may live in the remote SafariViewService process.

@apex-sentinel-staging

Copy link
Copy Markdown

Apex Sentinel

Verdict: request_changes

6 finding(s): 1 major, 2 minor, 3 nit. Verdict: request_changes. reached max rounds (1).

Required fixes

  • Placement guard for a dismiss-popup window is self-referential and can never reject a candidate

🟠 Major (1)

Where Finding
apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+AlertObservation.swift:57 Placement guard for a dismiss-popup window is self-referential and can never reject a candidate

🟡 Minor (2)

Where Finding
apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SystemModal.swift:130 Blocking system modal discovery now requires the modal to sit inside a SpringBoard window
apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+AlertObservation.swift:51 hostWindow widens from a placement check to an origin for every window-shaped snapshot
🔵 Nit (3)
Where Finding
apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Alert.swift:173 New alert-activation failure path has no test
apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SynthesizedGesturePolicy.swift:194 SynthesizedCoordinateContext now validates with a stricter box guard than the code it replaced
apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+SystemModal.swift:157 isBlockingSystemModal keeps its name after becoming a placement test

Reply under an inline comment with @apex-sentinel-staging note ... or @apex-sentinel-staging pivot ... to re-check that finding.
Comment @apex-sentinel-staging review on this conversation to run a full review.

@apex-sentinel-staging apex-sentinel-staging Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apex Sentinel: 6 new findings on 428c5ff. The verdict and the full list are in the summary comment.

) -> [XCUIElementSnapshot] {
let frame = snapshot.frame
let visible = !frame.isNull && !frame.isEmpty && viewport.contains(CGPoint(x: frame.midX, y: frame.midY))
let hostWindow = snapshot.elementType == .window && SnapshotGeometry.isPositiveFinite(frame) ? frame : viewport

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟠 Major · Placement guard for a dismiss-popup window is self-referential and can never reject a candidate

alertSnapshots now derives the containment box from the node being matched: for a .window snapshot with a positive finite frame, hostWindow = snapshot.frame (line 57). The .dismissPopup case matches only snapshot.elementType == .window (line 67), so whenever that match succeeds the box the node is tested against is the node's own frame, and Self.isPlaced(frame, in: frame) (line 69) is true for every positive finite frame — a rectangle's center is always inside it. The visibility read the predecessor had, viewport.contains(center) against the owner app's snapshot frame, is therefore gone for exactly the one source whose candidate is a window: no marked window can be refused for placement any more, including one offset off screen or on the foldable's other panel, and the recursion also hands every descendant that new per-window box.

Suggested change
let hostWindow = snapshot.elementType == .window && SnapshotGeometry.isPositiveFinite(frame) ? frame : viewport
func alertSnapshots(
in snapshot: XCUIElementSnapshot,
source: RunnerAlertSource,
viewport: CGRect
) -> [XCUIElementSnapshot] {
let frame = snapshot.frame
let isWindow = snapshot.elementType == .window && SnapshotGeometry.isPositiveFinite(frame)
let hostWindow = isWindow ? frame : viewport
// A window candidate is placed against the box it was enumerated in, never against itself.
let placementBox = (isWindow && source == .dismissPopup) ? viewport : hostWindow
let matches: Bool
switch source {
case .blockingSystemModal:
matches = snapshot.elementType == .alert || snapshot.elementType == .sheet
case .appAlert:
matches = snapshot.elementType == .alert
case .safariDialog:
matches = snapshot.identifier == Self.safariDialogIdentifier
case .dismissPopup:
matches = isWindow && containsDismissPopupMarker(snapshot)
}
if matches && Self.isPlaced(frame, in: placementBox) { return [snapshot] }
return snapshot.children.flatMap { alertSnapshots(in: $0, source: source, viewport: hostWindow) }
}

Suggested change

Keep the placement test anchored to the viewport the candidate was enumerated against when the candidate itself is the host window: pass the incoming viewport (not the node's own frame) as the box for the .dismissPopup window match, or track the outermost/owner viewport separately so a window candidate is still tested against the app's visible frame.

Details

Failing sequence: alert dismiss on a popup whose owner app's snapshot still carries a marked window outside the visible panel (a popover window SpringBoard/app keeps off-panel or at an offset position, which is what this PR's Duo work shows exists). Before, that window failed the viewport test, the walk found no candidate, the observation was .absent, and the command returned dismissed. Now it is a candidate whose presentation is unchanged, so the verification loop at RunnerTests+Alert.swift:124-137 spins on .stillVisible to the deadline and answers ALERT_DEADLINE_EXCEEDED / INTERACTION_FAILED with activated: true after the tap already went out. Two such windows (one per panel) additionally trip guard candidates.count <= 1 at line 45 and make the whole observation unavailable (ALERT_CONFIRMATION_UNAVAILABLE). No test covers .dismissPopup placement through this path; the new test in RunnerTests+AlertObservationTests.swift covers only .safariDialog and .appAlert.

Also raised here

Also raised at this location by swift-ios: Placement gate in alertSnapshots is vacuous for the .dismissPopup source — alertSnapshots now computes hostWindow as the snapshot's own frame whenever snapshot.elementType == .window and that frame is positive-finite (RunnerTests+AlertObservation.swift:57), and then requires Self.isPlaced(frame, in: hostWindow) (line 69). For source == .dismissPopup, matches is true only when snapshot.elementType == .window && containsDismissPopupMarker(snapshot) (lines 66-67) — i.e. the only snapshots that can match are exactly the ones for which hostWindow was just set to their own frame. The containment test therefore compares a window's center with its own rect and can never fail; isPlaced reduces to SnapshotGeometry.isPositiveFinite(frame), which is already the first clause. The predecessor passed the application snapshot frame down unchanged, so a dismiss-popup window whose center fell outside the app frame was refused as not visible. …

persona: swift-ios, senior-developer

Reply @apex-sentinel-staging note ... to add context, or @apex-sentinel-staging pivot ... if this is wrong — I will re-check the cited code.

Useful? Reply @apex-sentinel-staging like, or @apex-sentinel-staging dislike <why> if it is not.

return firstBlockingSystemModal(in: springboard, matching: .sheet, deadline: deadline)
}

private func firstBlockingSystemModal(

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Minor · Blocking system modal discovery now requires the modal to sit inside a SpringBoard window

firstBlockingSystemModal used to enumerate springboard.alerts / springboard.sheets directly, so any alert- or sheet-shaped element in SpringBoard's tree was a candidate regardless of where it sat. The replacement enumerates springboard.windows.containing(type, identifier: nil) and then window.descendants(matching: type), so a modal that XCTest surfaces directly under the application element (not under a windows child) is now invisible to the probe, and alert get/accept/dismiss and the blocking-system-modal snapshot report ALERT_NOT_FOUND/nil for it. This is the same discovery path the alert command's public iOS behavior depends on, so a regression here is user-visible. The PR's device validation covered SpringBoard openurl prompts only; no unit or fixture test pins a modal outside a window (the new test exercises only Self.isPlaced). If the window-nested assumption is intended, the probe should keep a fallback over springboard.alerts/sheets when no window candidate matches, and the assumption should be stated in the comment above SpringBoardModal.

Suggested change

Confirm on a device that every SpringBoard modal the probe previously matched is nested under a windows child; otherwise add a fallback to the old springboard.alerts/springboard.sheets enumeration when no window-hosted candidate resolves, and add a fixture test for a modal that is not under a window.

Details

Also raised here

Also raised at this location by senior-developer: Unanswered launch confirmations are no longer surfaced when the panel window names no alert or sheet — firstBlockingSystemModal changed the enumeration from the app-level queries springboard.alerts / springboard.sheets to springboard.windows.containing(type, identifier: nil) (line 136) and only then reads window.descendants(matching: type). A modal that XCTest reports through app.alerts/app.sheets but that is not a descendant of a window node — or sits in a window whose own frame is null/empty, which isBlockingSystemModal then refuses via isPlaced (line 162, 168) — is no longer found at all. The predecessor tested the element's center against springboard.frame and had no window prerequisite, so such a modal was resolved. This regresses the behavior commit 3d91901 ("report the alert's own title and surface an unanswered launch confirmation", #​3732) added: an unanswered launch confirmation must be surfaced, and with it the caller now gets ALERT_NOT_FOUND on a screen that visibly blocks the device. …

persona: javascript, senior-developer

Reply @apex-sentinel-staging note ... to add context, or @apex-sentinel-staging pivot ... if this is wrong — I will re-check the cited code.

Useful? Reply @apex-sentinel-staging like, or @apex-sentinel-staging dislike <why> if it is not.

}

private func alertSnapshots(
func alertSnapshots(

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Minor · hostWindow widens from a placement check to an origin for every window-shaped snapshot

In alertSnapshots the host frame is taken from any snapshot whose elementType is .window, but .window is also the matching shape for .dismissPopup, and the recursion now overwrites viewport with that frame for all children. Two consequences: (1) a popup window that matches .dismissPopup is measured against its own frame, so isPlaced is self-referential and always true — the old viewport.contains(center) rejection of a window sitting outside the app's reported frame (a zero-height or off-panel SpringBoard window) is gone; (2) once one window frame is adopted it is never restored for sibling branches, and on the Duo SpringBoard's first window is the 223x317 status-bar window this PR's own description names, so modals below it are checked against that tiny box, or against a window frame on the wrong panel, and are dropped as not placed. Pass the viewport down unchanged and use the window frame only as the host for the one snapshot that is the window.

Suggested change

Keep viewport as the parameter passed to the recursive call, and compare a window-shaped snapshot against the viewport while comparing its descendants against that window's frame.

Details

persona: maintainability

Reply @apex-sentinel-staging note ... to add context, or @apex-sentinel-staging pivot ... if this is wrong — I will re-check the cited code.

Useful? Reply @apex-sentinel-staging like, or @apex-sentinel-staging dislike <why> if it is not.

return
}
switch synthesizedTapAt(app: alert.ownerApp, x: frame.midX, y: frame.midY, deadline: deadline) {
var hostContext: SynthesizedCoordinateContext?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Nit · New alert-activation failure path has no test

activateAlertButton gains a new refusal: when alert.window is set but its frame read fails (safely("ALERT_WINDOW", CGRect.null) yields a non-positive-finite box), the command returns .unsupported("alert activation could not read the window hosting the alert") instead of tapping. The sibling pre-synthesis refusal in the same function (missing _waitForQuiescenceAsPreEvent:) and the deadline paths are pinned by RunnerTests+AlertObservationTests, but this new branch is not, and the file already carries the stubbing hooks (alertResolutionOverrideForTesting, AlertTapDeadlineStub) needed to reach it.

Suggested change

Add a unit test that resolves an alert whose window frame read throws or returns CGRect.null and asserts the unsupported outcome and that no tap was synthesized.

Details

persona: javascript

Reply @apex-sentinel-staging note ... to add context, or @apex-sentinel-staging pivot ... if this is wrong — I will re-check the cited code.

Useful? Reply @apex-sentinel-staging like, or @apex-sentinel-staging dislike <why> if it is not.

}
}

extension SynthesizedCoordinateContext {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Nit · SynthesizedCoordinateContext now validates with a stricter box guard than the code it replaced

The inline guard in synthesizedCoordinateContext (isFinite + width/height > 0) was replaced by SnapshotGeometry.isPositiveFinite (RunnerTests+SynthesizedGesturePolicy.swift:201). The new guard also refuses CGRect.infinite and a finite box whose maxX/maxY overflow, and it checks all four coordinates' finiteness, not just the extents. That is a behavior change on the shared coordinate route: a previously accepted reference frame now yields nil, i.e. synthesizedTapAt answers "could not resolve an app window with a finite screen frame". The change is in the safer direction and matches the kernel/Swift twin rule cited in SnapshotGeometry.swift, but it is worth one comment saying the shared route intentionally uses the stricter box guard, since the two guards are not equivalent.

Details

persona: senior-developer

Reply @apex-sentinel-staging note ... to add context, or @apex-sentinel-staging pivot ... if this is wrong — I will re-check the cited code.

Useful? Reply @apex-sentinel-staging like, or @apex-sentinel-staging dislike <why> if it is not.


private func safeIsBlockingSystemModal(_ element: XCUIElement, in springboard: XCUIApplication) -> Bool {
safely("MODAL_CHECK", false) { isBlockingSystemModal(element, in: springboard) }
private func safeIsBlockingSystemModal(_ element: XCUIElement, in window: XCUIElement) -> Bool {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Nit · isBlockingSystemModal keeps its name after becoming a placement test

Renaming the parameter from springboard to window and replacing the three guard clauses with one isPlaced call leaves the name promising more than the function now decides: existence and placement only, nothing about modality or blocking. safeIsBlockingSystemModal and firstBlockingSystemModal inherit the same drift two layers up.

Suggested change

Rename to something like isPresentedInWindow (and the same for the safe/first… wrappers) or state in the doc comment that blocking-ness is decided by the caller.

Details

persona: maintainability

Reply @apex-sentinel-staging note ... to add context, or @apex-sentinel-staging pivot ... if this is wrong — I will re-check the cited code.

Useful? Reply @apex-sentinel-staging like, or @apex-sentinel-staging dislike <why> if it is not.

@thymikee

Copy link
Copy Markdown
Member Author

The code looks good at 428c5ff. It fixes the open items from the earlier review (#4001 (comment)): the live evidence is now in the PR, and Smoke and Vercel now pass. Not blocking, and fine to take or leave: the PR body calls the Safari runs at 3369c71 "same runner code", but the rebase changed the shared button chooser to RunnerAlertButtonChoice.buttonIndex(..., vocabulary: .system) (https://github.com/callstack/agent-device/blob/428c5ff/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Alert.swift#L302), so the Safari Open/Cancel choice at head is covered only by the SpringBoard runs. Either reword that line to say the Safari runs predate the rebase, or rerun one Safari dismiss at head.

The live evidence is log lines transcribed by the author, without screenshots or raw runner logs. I did not run a simulator or the unit tests.

Of the six Apex Sentinel threads, five do not apply and can be replied to and resolved: #4001 (comment) (window candidate placed against its own frame on purpose, as an earlier P1 asked), #4001 (comment) (modals are found through the windows that host them; the live alert was found this way on three devices), #4001 (comment) (hostWindow is computed per call, so siblings do not inherit the parent's box), #4001 (comment) (the stricter finite-frame guard is the fix an earlier P2 asked for), and #4001 (comment) (base already checked the same conditions, so the name did not drift). The sixth, #4001 (comment), is a non-blocking nit about an untested refusal branch. The Cubic P3 thread #4001 (comment) is fixed at head and already resolved.

CI is 20 of 21 green. The one check not passing is the Apex Sentinel review check, which is a request for changes, not a build or test job, and its one required fix does not apply. Replying on and resolving those threads should clear that check. The open question on how SFSafariViewController inside a third-party app exposes SFDialogView is still with the author.

@thymikee thymikee added the ready-for-human Valid work that needs human implementation, judgment, or maintainer merge label Oct 30, 2026
@thymikee
thymikee merged commit ce014b1 into main Oct 31, 2026
20 of 21 checks passed
@thymikee
thymikee deleted the fix/ios-springboard-modal-host-window branch October 31, 2026 06:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-human Valid work that needs human implementation, judgment, or maintainer merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant